package com.jeecg.study.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.jws.soap.SOAPBinding.Use;

import com.jeecg.study.entity.MessageVo;
import com.jeecg.study.entity.User;
import com.jeecg.study.entity.UserForm;
import com.jeecg.study.form.ActionForm;
import com.jeecg.study.service.LoginService;

public class LoginServiceImpl implements LoginService {

	@Override
	public Map<String, MessageVo> executeLogin(UserForm form) {
		Map<String, MessageVo> map = new HashMap<>();
		MessageVo message=new MessageVo();
		Boolean login = isLogin(form);
		if(login){
			message.setResult("登录成功!");
			message.setUserName(form.getUserName());
			map.put("/WEB-INF/views/modules/success.jsp", message);
		}else{
			message.setResult("登录失败!");
			message.setUserName(form.getUserName());
			map.put("fail.jsp", message);
		}
		return map;
	}
	
	/**
	 * @see 判断是否登录成功
	 * @param o
	 */
	private Boolean isLogin(UserForm user) {
		if("admin".equals(user.getUserName()) && "123".equals(user.getPassword())){
			return true;
		}
		return false;
	}

}
